package test.imageprocess.position;

import static org.junit.Assert.*;

import java.awt.AWTException;
import java.awt.Color;
import java.io.IOException;

import org.junit.Test;
import org.rslai.util.imageprocess.position.Area;
import org.rslai.util.imageprocess.position.SpecifiedRegion;

public class testSpecifiedRegion {

	/**
	 * 屏幕查找黄色区块
	 * @throws AWTException
	 * @throws IOException 
	 */
	@Test
	public void test() throws AWTException, IOException {
		Area area = new SpecifiedRegion().getSpecifiedRegion(Color.YELLOW, 5);
		if (area == null) {
			fail("没找到指定的黄色区块，先确认一下屏幕中是否有黄色区块。");
		} else {
			System.out.println("黄色区块找到：" + area);
		}
	}

	/**
	 * 从图片中查找黄色区块
	 */
	@Test
	public void test1() throws IOException {
		Area area = new SpecifiedRegion().getSpecifiedRegion("resources/specifiedRegion.png", Color.YELLOW, 5);
		
		if (area == null) {
			fail("没找到指定的黄色区块，先确认一下图片中是否有黄色区块。");
		} else {
			System.out.println("黄色区块找到：" + area);
		}
	}

}
